<!DOCTYPE html>
<html lang="en" xmlns:shiro="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>首页</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link th:href="@{/asserts/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/asserts/css/font-awesome.min.css}" rel="stylesheet">
    <link th:href="@{/asserts/css/plugins/footable/footable.core.css}" rel="stylesheet">
    <link th:href="@{/asserts/css/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet">
    <link th:href="@{/asserts/css/animate.min.css}" rel="stylesheet">
    <link th:href="@{/asserts/css/style.min.css}" rel="stylesheet">
    <link th:href="@{/asserts/css/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">


    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="col-md-3">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <span class="label label-primary pull-right"><span class="fa fa-home"></span> </span>
                        <h5>国有企业</h5>
                    </div>
                    <div class="ibox-content">

                        <div class="row">
                            <div class="col-md-6">
                                <h1 class="no-margins" id="aa"></h1>
                                <div class="font-bold text-navy">
                                    <small>集团</small>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <h1 class="no-margins" id="ab"></h1>
                                <div class="font-bold text-navy">
                                    <small>全集次</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


            <div class="col-md-3">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <span class="label label-primary pull-right"><span class="fa fa-tint"></span> </span>
                        <h5>单位类型</h5>
                    </div>
                    <div class="ibox-content">

                        <div class="row">
                            <div class="col-md-6">
                                <h1 class="no-margins" id="ba"></h1>
                                <div class="font-bold text-navy">
                                    <small>法人单位</small>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <h1 class="no-margins" id="bb"></h1>
                                <div class="font-bold text-navy">
                                    <small>非法人单位</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <span class="label label-primary pull-right"><span class="fa fa-balance-scale"></span> </span>
                        <h5>上市单位</h5>
                    </div>
                    <div class="ibox-content">

                        <div class="row">
                            <div class="col-md-6">
                                <h1 class="no-margins" id="ca"></h1>
                                <div class="font-bold text-navy">
                                    <small>上市单位</small>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <h1 class="no-margins" id="cb"></h1>
                                <div class="font-bold text-navy">
                                    <small>非上市单位</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <span class="label label-primary pull-right"><span class="fa fa-vimeo-square"></span> </span>
                        <h5>境内境外</h5>
                    </div>
                    <div class="ibox-content">

                        <div class="row">
                            <div class="col-md-6">
                                <h1 class="no-margins" id="da"></h1>
                                <div class="font-bold text-navy">
                                    <small>境内</small>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <h1 class="no-margins" id="db"></h1>
                                <div class="font-bold text-navy">
                                    <small>境外</small>
                                </div>
                            </div>
                        </div>


                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div>
                        <h3 class="font-bold no-margins">
                            经营状态
                        </h3>
                        <small>集团公司</small>
                    </div>

                    <div class="m-t-sm">

                        <div class="row">
                            <div id="a1" style="width: 100%;height:400%;"></div>
                        </div>

                    </div>

                    <div class="m-t-md">
                        <small>
                            <strong>说明：</strong> 根据在册企业的的现有经营状态进行统计。
                        </small>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div>
                        <h3 class="font-bold no-margins">
                            集团公司汇总表
                        </h3>
                    </div>
                    <table id="table"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<div th:replace="common/pop/confirm::showConfirm"></div>

<script th:src="@{/asserts/js/jquery.min.js}"></script>
<script th:src="@{/asserts/js/bootstrap.min.js}"></script>
<script th:src="@{/asserts/js/plugins/footable/footable.all.min.js}"></script>
<script th:src="@{/asserts/js/content.min.js}"></script>
<script th:src="@{/asserts/js/echarts.min.js}" type="text/javascript"></script>

<script th:src="@{/asserts/js/bootstrap-table/bootstrap-table.min.js?v=1}"></script>
<script th:src="@{/asserts/js/bootstrap-table/locale/bootstrap-table-zh-CN.js}"></script>
<script th:replace="common/myJs::myCommonJs"></script>

<script>
    $(function () {
        createTable();
        a1();
        a2();
    });

    function createTable() {
        let url = '[[@{/orgbase/list}]]';
        $("#table").bootstrapTable('destroy');
        $("#table").bootstrapTable({
            url: url,        //请求后台的URL（*）
            method: 'post',                      //请求方式（*）
            contentType: "application/x-www-form-urlencoded",
            pagination: true,                   //是否显示分页（*）
            cache: false,
            pageSize: 10,//每页一条数据
            striped: true,  //表格显示条纹
            dataField: "list",
            queryParamsType: "undefined",
            queryParams: function queryParams(params) {   //设置查询参数
                var param = {
                    pageNumber: params.pageNumber,
                    pageSize: params.pageSize,
                    unitname: '',
                    domain: ''
                };
                return param;
            },
            sidePagination: 'server',
            pageNumber: 1,
            columns: [{
                field: "uuid",
                visible: false
            }, {
                field: "unitname",
                title: "单位名称"
            }, {
                field: "creditcode",
                title: "企业编码"
            }, {
                field: "domain",
                title: "境内外标志"
            }, {
                field: "unittype",
                title: "单位类型"
            }, {
                field: "businessstatus",
                title: "经营状态"
            }]
        });
    }


    function a1() {
        var myChart = echarts.init(document.getElementById('a1'));
        myChart.showLoading();
        $.ajax({
            url: '[[@{/home/count}]]',
            type: "POST",
            success: function (data) {
                data = JSON.parse(data);
                console.log(data.legendData);
                console.log(data.seriesData);
                option = {
                    title: {
                        left: 'center'
                    },
                    tooltip: {
                        trigger: 'item',
                        formatter: '{a} <br/>{b} : {c} ({d}%)'
                    },
                    legend: {
                        orient: 'vertical',
                        right: 10,
                        top: 20,
                        bottom: 20,
                        data: data.legendData,
                        selected: data.selected
                    },
                    series: [
                        {
                            name: '姓名',
                            type: 'pie',
                            radius: '75%',
                            center: ['40%', '50%'],
                            data: data.seriesData,
                            emphasis: {
                                itemStyle: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };
                myChart.hideLoading();
                myChart.setOption(option);
            },
            error: function (data) {
            }
        })
    }


    function a2() {
        $.ajax({
            url: '[[@{/home/counttotal}]]',
            type: "post",
            success: function (data) {
                data = eval('(' + data + ')');
                $('#aa').text(1);
                $('#ab').text(data.ab);
                $('#ba').text(data.ba);
                $('#bb').text(data.bb);
                $('#ca').text(data.ca);
                $('#cb').text(data.cb);
                $('#da').text(data.da);
                $('#db').text(data.db);

            }
        });
    }


</script>
</body>

</html>